# token加密
from itsdangerous import TimedJSONWebSignatureSerializer as Serializer
from django.conf import settings
import logging
logger = logging.getLogger('django')
# 加密方法
def dumps_token(token):
    serializer = Serializer(settings.SECRET_KEY, expires_in=3600)
    token_b = serializer.dumps(token)
    return token_b.decode()

# 解密方法

def loads_token(token_b):
    serializer = Serializer(settings.SECRET_KEY, expires_in=3600)
    token_dict = serializer.loads(token_b)

    return token_dict




